﻿// Copyright (c) 2012 - 2020 Jared Zheng <jaredz at outlook dot com>
// Buddha Framework is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
//          http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PSL v2 for more details.
//
// Create : 2012-12-01 version 0.1 Jared Zheng <jaredz at outlook dot com>
// Update : 2018-12-05 version 3.1.5 Jared Zheng <jaredz at outlook dot com>

#ifndef __BALANCE_PACKET_INL__
#define __BALANCE_PACKET_INL__

#pragma once

///////////////////////////////////////////////////////////////////////////////////////////////////////////
// CTPAKBalanceAddrAck : 获取地址
template <UEVENT uEvent, UTYPE uType>
INLINE CTPAKBalanceAddrAck<uEvent, uType>::CTPAKBalanceAddrAck(UACK uAck)
: CTPAKHeadBase<uEvent, uType>(uAck)
{
}

template <UEVENT uEvent, UTYPE uType>
INLINE CTPAKBalanceAddrAck<uEvent, uType>::~CTPAKBalanceAddrAck(void)
{
}

template <UEVENT uEvent, UTYPE uType>
INLINE CTPAKBalanceAddrAck<uEvent, uType>::CTPAKBalanceAddrAck(const CTPAKBalanceAddrAck& aSrc)
: CTPAKHeadBase<uEvent, uType>(aSrc)
{
    m_Addr = aSrc.m_Addr;
}

template <UEVENT uEvent, UTYPE uType>
INLINE CTPAKBalanceAddrAck<uEvent, uType>& CTPAKBalanceAddrAck<uEvent, uType>::operator=(const CTPAKBalanceAddrAck& aSrc)
{
    if (&aSrc != this)
    {
        CTPAKHeadBase<uEvent, uType>::operator=(aSrc);
        m_Addr = aSrc.m_Addr;
    }
    return (*this);
}

template <UEVENT uEvent, UTYPE uType>
INLINE size_t CTPAKBalanceAddrAck<uEvent, uType>::Length(void)
{
    return (m_Addr.Length() + CTPAKHeadBase<uEvent, uType>::Length());
}

template <UEVENT uEvent, UTYPE uType>
INLINE void CTPAKBalanceAddrAck<uEvent, uType>::Serialize(CStream& Stream)
{
    CTPAKHeadBase<uEvent, uType>::Serialize(Stream);
    m_Addr.Serialize(Stream);
}

template <UEVENT uEvent, UTYPE uType>
INLINE CNetAddr& CTPAKBalanceAddrAck<uEvent, uType>::GetAddr(void)
{
    return m_Addr;
}

template <UEVENT uEvent, UTYPE uType>
INLINE void CTPAKBalanceAddrAck<uEvent, uType>::SetAddr(CNetAddr& Addr)
{
    m_Addr = Addr;
}

#endif // __BALANCE_PACKET_INL__
